#include "allowance_type_detail.hpp"
#include "file_list.hpp"

allowance_type_detail_struct_csv const allowance_type_detail_csv::find(int _parent_id, int _child_id)
{
	csv_struct csv_file(file_list::allowance_type_detail_filename());
	while(_child_id && _parent_id && !csv_file.eof())
	{
		++csv_file;
		allowance_type_detail_struct_csv row(csv_file.get_line());
			
		if(row.parent_id() != _parent_id || row.child_id() != _child_id) continue;
			
		return row;

	}

	allowance_type_detail_struct_csv allowance_type_detail_struct_csv_null;
	return allowance_type_detail_struct_csv_null;
}

float allowance_type_detail_csv::find_limit(int _parent_id, int _child_id)
{
		return static_cast<allowance_type_detail_struct_csv>(find(_parent_id, _child_id)).allowance_limit();
}